<%@ page import="dao.impl.GoodDaoImpl" %>
<%@ page import="po.Good" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="resources/css/amazeui.min.css" />
    <link rel="stylesheet" href="resources/css/admin.css" />
</head>
<%
    String goodname = request.getParameter("goodname");
    GoodDaoImpl goodDao = new GoodDaoImpl();
    StringBuilder sql = new StringBuilder("select * from good where 1 = 1 ");
    if (goodname != null) {//查询时用
        sql.append(" and good_name =");
        sql.append("'").append(goodname).append("'");
    }
    List<Good> goods = goodDao.selectGood(String.valueOf(sql));
%>
<body>
<div class="admin-content-body">
    <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">仓库物品管理</strong><small></small></div>
    </div>
    <hr>
    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-3">
        </div>
        <div class="am-u-sm-12 am-u-md-3">
            <div class="am-input-group am-input-group-sm">
					<span class="am-input-group-btn">
						<form action="goodManage.jsp" method="post">
                            <label>
                                <input type="text" name="goodname" class="am-form-field"
                                style="width: 100px; height: 36px;">
                                <button class="am-btn am-btn-default" type="submit">搜索</button>
                            </label>
						</form>
					</span>
            </div>
        </div>
    </div>
    <div class="am-g">
        <div class="am-u-sm-12">
            <form class="am-form">
                <table class="am-table am-table-striped am-table-hover table-main">
                    <thead>
                    <tr>
                        <th class="table-id">编号</th>
                        <th class="table-title">货物名称</th>
                        <th class="table-title">货物类型</th>
                        <th class="table-title">货物数量</th>
                        <th class="table-title">货物价格</th>
                        <th class="table-set">操作货物</th>
                    </tr>
                    </thead>
                    <%
                        for (Good g : goods) {
                    %>
                    <tbody>
                    <tr>
                        <td><%=g.getGoodId()%>
                        </td>
                        <td>
                            <a href="#"><%=g.getGoodName()%>
                            </a>
                        </td>
                        <td>
                            <a href="#"><%=g.getType()%>
                            </a>
                        </td>
                        <td>
                            <a href="#"><%=g.getCount() %>
                            </a>
                        </td>
                        <td>
                            <a href="#"><%=g.getCost() %>
                            </a>
                        </td>
                        <td>
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button class="am-btn am-btn-default am-btn-xs am-text-secondary">
                                        <a href="updateGood.jsp?goodid=<%=g.getGoodId()%>">修改</a>
                                    </button>
                                    <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only">
                                        <a href="putStorage.jsp?goodid=<%=g.getGoodId()%>">入库</a>
                                    </button>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <%}%>
                    </tbody>
                </table>
                <hr>
            </form>
        </div>
    </div>
</div>
</body>
</html>
